﻿@model IEnumerable<BugTracker.Models.Project>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>


   @{WebGrid webGrid = new WebGrid(canSort: false, canPage: true, rowsPerPage: 2, ajaxUpdateContainerId: "grid", defaultSort: "project_idPK", pageFieldName: "Page");
    webGrid.Bind(Model, autoSortAndPage: true, rowCount: Model.Count());    
    }                 
   
<center>         
<div id="grid">
@webGrid.GetHtml(htmlAttributes: new { id = "grid" },
        alternatingRowStyle: "altrow",
        mode: WebGridPagerModes.All,
               firstText: "<<first",
               previousText: "<previous",
               nextText: "next >",
               lastText: "last >>",

         columns: webGrid.Columns(
                  webGrid.Column(columnName: "Project ID", format: (item) => item.project_idPK),
                  webGrid.Column(columnName: "Project Name", format: (item) => item.project_name),
                  webGrid.Column(columnName: "Date Created", format: (item) => item.project_datecreated),
                  webGrid.Column(columnName: "Status", format: (item) => item.status_id),
                  webGrid.Column(columnName: "Project Deadline", format: (item) => item.project_deadline.ToString("MM/dd/yyy")),
                  webGrid.Column(header: "Action",
                                                     style: "action",
                                                     format: (item) => new HtmlString(Html.ActionLink("Details", "Details", new { id = item.project_idPK }) + " | " + Html.ActionLink("Edit", "Edit", new { id = item.project_idPK }
                                                     )))
                                                     ))
</div> 
</center> 
<br />
<br />
<h4>
        Page Count:
        @Html.Encode(webGrid.PageCount)
        <br />
        Total Record:
        @Html.Encode(webGrid.TotalRowCount)
</h4>

